import 'package:flutter/widgets.dart';
import 'package:flutter_getx/ui/user/user_routers.dart';
import 'package:flutter_getx/utils/cache_utils.dart';
import 'package:get/get.dart';

extension AnyExtension on Object? {

  void checkLogin([Function? function]) {
    if (CacheUtils.isLogin()) {
      function?.call();
    } else {
      jumpLogin();
    }
  }

  void jumpLogin() {
    Get.toNamed(loginPage);
  }

}